<?php
define( 'HOME_URI', home_url() );
define( 'THEME_URI', get_stylesheet_directory_uri() );
define( 'THEME_IMAGES', THEME_URI . '/assets/img' );
define( 'THEME_CSS', THEME_URI . '/assets/css' );
define( 'THEME_JS', THEME_URI . '/assets/js' );
define( 'THEME_DIR', get_template_directory() );

// Creates a nicely formatted and more specific title element text for output
function uni_wp_title( $title, $sep ) {
	global $paged, $page;

	if ( is_feed() )
		return $title;

	// Add the site name.
	$title .= get_bloginfo( 'name' );

	// Add the site description for the home/front page.
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) )
		$title = "$title $sep $site_description";

	// Add a page number if necessary.
	if ( $paged >= 2 || $page >= 2 )
		$title = "$title $sep " . sprintf( __( 'Page %s', 'unitheme' ), max( $paged, $page ) );

	return $title;
}
add_filter( 'wp_title', 'uni_wp_title', 10, 2 );

function register_my_menus() {
  register_nav_menus(
    array(
      'header-menu' => __( 'Header Menu' ),
      'extra-menu' => __( 'Extra Menu' )
    )
  );
}
add_action( 'init', 'register_my_menus' );

//function for call ajax
locate_template( 'inc/ajax-functions.php', TRUE, TRUE );

add_action('wp_ajax_nopriv_do_ajax', 'our_ajax_function');
add_action('wp_ajax_do_ajax', 'our_ajax_function');
function our_ajax_function(){

    // the first part is a SWTICHBOARD that fires specific functions
    // according to the value of Query Var 'fn'

    switch($_REQUEST['fn']){
        case 'ajax_login':
            $output = ajax_login();
            break;
        case 'ajax_register':
            $output = ajax_register();
            break;
        case 'ajax_CUP':
            $output = ajax_CUP();
            break;
        case 'ajax_question':
            $output = ajax_question();
            break;
        case 'ajax_invite':
            $output = ajax_invite();
            break;
        case 'ajax_social':
            $output = ajax_social();
            break;
        case 'first500':
            $output = first500();
            break;
        case 'ajax_forgotpass':
            $output = ajax_forgotpass();
            break;
        default:
            $output = 'No function specified, check your jQuery.ajax() call';
            break;

    }

    // at this point, $output contains some sort of valuable data!
    // Now, convert $output to JSON and echo it to the browser
    // That way, we can recapture it with jQuery and run our success function

    $output=json_encode($output);
    if(is_array($output)){
        print_r($output);
    }
    else{
        echo $output;
    }
    die;

}
function list_style_method()  
{  
	wp_register_style( 'style.css', get_template_directory_uri() . '/assets/css/style.css');  
	wp_enqueue_style( 'style.css' );  
}  
add_action( 'wp_enqueue_scripts', 'list_style_method' );  